﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.UI.Design;
using System.ComponentModel.Design;
using System.Web.UI.Design.WebControls;
using System.Web.UI;
using Terralever.Facebook.UI.FbmlControls;
using System.Web.UI.WebControls;
using System.IO;

namespace Terralever.Facebook.UI.Design.FbmlControls
{
    internal class RequestFormDesigner : ControlDesigner
    {
        private static string _dth;
        //private class RequestFormTemplateEditableDesignerRegion : TemplatedEditableDesignerRegion
        //{
        //    private RequestForm m_form;
        //    public RequestFormTemplateEditableDesignerRegion(RequestForm form, TemplateDefinition templateDefinition)
        //        : base(templateDefinition)
        //    {
        //        m_form = form;
        //    }

        //    public override ViewRendering GetChildViewRendering(Control control)
        //    {
        //        if (control == null)
        //            throw new ArgumentNullException("control");
        //        return ControlDesigner.GetViewRendering(control);
        //    }
        //}

        private DesignerActionListCollection m_lists;

        public override string GetDesignTimeHtml()
        {
            if (_dth == null)
            {
                StringBuilder sb = new StringBuilder();
                for (int i = 0; i < 5; i++)
                {
                    sb.Append(Constants.FMT_MULTI_FRIEND_SELECT_FULL_USER_OPTION);
                }
                _dth = string.Format(Constants.FMT_MULTI_FRIEND_SELECT_FULL_FORM,
                    ((Terralever.Facebook.UI.FbmlControls.RequestForm)Component).Action,
                    Constants.FMT_MULTI_FRIEND_SELECT_FULL_FILTERS,
                    string.Format(Constants.FMT_MULTI_FRIEND_SELECT_FULL_FRIENDS_UL, sb.ToString()),
                    Constants.FMT_MULTI_FRIEND_SELECT_FULL_BUTTONS);
            }
            return _dth;
        }

        //public override System.ComponentModel.Design.DesignerActionListCollection ActionLists
        //{
        //    get
        //    {
        //        if (m_lists == null)
        //        {
        //            m_lists = new DesignerActionListCollection();
        //            m_lists.Add(new RequestFormActionList(Component));
        //        }
        //        return m_lists;
        //    }
        //}
    }
}
